package com.chinasofti.exceptiondemo;

/*
public static void 方法名() throws 异常类名 {

 */

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Edemo4 {
    public static void main(String[] args) {
        try {
            String s = "2023-05-05";
            //s = "abc";
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date d = sdf.parse(s);
            System.out.println("d = " + d);
            String sr = null;
            System.out.println(sr.equals("haha"));
        } catch (ParseException e) {
            System.out.println(" 发生异常了，解析失败 ");
        } //catch (Exception e){//范围大的父类要写在最后面

        //}
        System.out.println("执行完毕");

    }


}
